<?php

// 4/25/2010: immanuel192 write this action to return bible verse list

if (!defined('EXPONENT')) exit('');

global $db;
// get t2 value, just for fun
$t2=$_GET['t2'];
$id = -1;
if (isset($_REQUEST['book']) && isset($_REQUEST['chapter']) && isset($_REQUEST['translation']))
{
	$translation = intval($_REQUEST['translation']);
	// get translation sortname
	$bible=$db->selectObject("bibles","id = {$translation}");
	if ($bible == null) 
	{
		die();
	}
	else
	{
		$short_name = $bible->short_name;
		$book=intval($_REQUEST['book']); $chapter=intval($_REQUEST['chapter']);
	
		$data=$db->max("bible_".$short_name,"verse","","book = {$book} AND chapter = {$chapter}");
		$html="";
		for ($i=1;$i<=$data;$i++)
			$html.="<option value={$i}>{$i}</option>";
		echo $t2; echo $html;	
	}
}
else
{
	die();
}
?>
